1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module pango.PgFontFace;
26 
27 private import glib.Str;
28 private import glib.c.functions;
29 private import gobject.ObjectG;
30 private import pango.PgFontDescription;
31 private import pango.PgFontFamily;
32 private import pango.c.functions;
33 public  import pango.c.types;
34 
35 
36 /**
37  * A `PangoFontFace` is used to represent a group of fonts with
38  * the same family, slant, weight, and width, but varying sizes.
39  */
40 public class PgFontFace : ObjectG
41 {
42 	/** the main Gtk struct */
43 	protected PangoFontFace* pangoFontFace;
44 
45 	/** Get the main Gtk struct */
46 	public PangoFontFace* getPgFontFaceStruct(bool transferOwnership = false)
47 	{
48 		if (transferOwnership)
49 			ownedRef = false;
50 		return pangoFontFace;
51 	}
52 
53 	/** the main Gtk struct as a void* */
54 	protected override void* getStruct()
55 	{
56 		return cast(void*)pangoFontFace;
57 	}
58 
59 	/**
60 	 * Sets our main struct and passes it to the parent class.
61 	 */
62 	public this (PangoFontFace* pangoFontFace, bool ownedRef = false)
63 	{
64 		this.pangoFontFace = pangoFontFace;
65 		super(cast(GObject*)pangoFontFace, ownedRef);
66 	}
67 
68 
69 	/** */
70 	public static GType getType()
71 	{
72 		return pango_font_face_get_type();
73 	}
74 
75 	/**
76 	 * Returns a font description that matches the face.
77 	 *
78 	 * The resulting font description will have the family, style,
79 	 * variant, weight and stretch of the face, but its size field
80 	 * will be unset.
81 	 *
82 	 * Returns: a newly-created `PangoFontDescription` structure
83 	 *     holding the description of the face. Use [method@Pango.FontDescription.free]
84 	 *     to free the result.
85 	 */
86 	public PgFontDescription describe()
87 	{
88 		auto __p = pango_font_face_describe(pangoFontFace);
89 
90 		if(__p is null)
91 		{
92 			return null;
93 		}
94 
95 		return ObjectG.getDObject!(PgFontDescription)(cast(PangoFontDescription*) __p, true);
96 	}
97 
98 	/**
99 	 * Gets a name representing the style of this face.
100 	 *
101 	 * Note that a font family may contain multiple faces
102 	 * with the same name (e.g. a variable and a non-variable
103 	 * face for the same style).
104 	 *
105 	 * Returns: the face name for the face. This string is
106 	 *     owned by the face object and must not be modified or freed.
107 	 */
108 	public string getFaceName()
109 	{
110 		return Str.toString(pango_font_face_get_face_name(pangoFontFace));
111 	}
112 
113 	/**
114 	 * Gets the `PangoFontFamily` that @face belongs to.
115 	 *
116 	 * Returns: the `PangoFontFamily`
117 	 *
118 	 * Since: 1.46
119 	 */
120 	public PgFontFamily getFamily()
121 	{
122 		auto __p = pango_font_face_get_family(pangoFontFace);
123 
124 		if(__p is null)
125 		{
126 			return null;
127 		}
128 
129 		return ObjectG.getDObject!(PgFontFamily)(cast(PangoFontFamily*) __p);
130 	}
131 
132 	/**
133 	 * Returns whether a `PangoFontFace` is synthesized.
134 	 *
135 	 * This will be the case if the underlying font rendering engine
136 	 * creates this face from another face, by shearing, emboldening,
137 	 * lightening or modifying it in some other way.
138 	 *
139 	 * Returns: whether @face is synthesized
140 	 *
141 	 * Since: 1.18
142 	 */
143 	public bool isSynthesized()
144 	{
145 		return pango_font_face_is_synthesized(pangoFontFace) != 0;
146 	}
147 
148 	/**
149 	 * List the available sizes for a font.
150 	 *
151 	 * This is only applicable to bitmap fonts. For scalable fonts, stores
152 	 * %NULL at the location pointed to by @sizes and 0 at the location pointed
153 	 * to by @n_sizes. The sizes returned are in Pango units and are sorted
154 	 * in ascending order.
155 	 *
156 	 * Params:
157 	 *     sizes = location to store a pointer to an array of int. This array
158 	 *         should be freed with g_free().
159 	 *
160 	 * Since: 1.4
161 	 */
162 	public void listSizes(out int[] sizes)
163 	{
164 		int* outsizes;
165 		int nSizes;
166 
167 		pango_font_face_list_sizes(pangoFontFace, &outsizes, &nSizes);
168 
169 		sizes = outsizes[0 .. nSizes];
170 	}
171 }